package com.pccw.ssh.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.pccw.ssh.factory.SpringBeanFactory;
import com.pccw.ssh.form.StockForm;
import com.pccw.ssh.service.StockService;
import com.pccw.ssh.vo.StockVO;

public class StockAddAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		StockForm stockForm = (StockForm) form;
		StockVO stockVO = stockForm.toVO();
		StockService stockService = (StockService) SpringBeanFactory.getBean("stockService");
		stockService.add(stockVO);
		return mapping.findForward("success");

	}

}
